package com.ccy.legendary.Operation.pojo;

public enum Stage {
    start(1, "开始"),
    run(2, "移动"),
    battle(3, "战斗"),
    map(4, "地形"),
    end(5, "结束"),
    chainJudge(6, "连锁判定"),
    lifeJudge(7, "濒死判定"),
    poorJudge(8, "破产判定"),
    winJudge(9, "胜利判定");


    private final int code;

    private final String caption;

    Stage(int code, String caption) {
        this.code = code;
        this.caption = caption;

    }

    public static Stage codeOf(int code) {
        for (Stage stage : Stage.values()) {
            if (stage.getCode() == code) {
                return stage;
            }
        }
        return null;
    }

    public static String getCaption(int code) {
        for (Stage stage : Stage.values()) {
            if (stage.getCode() == code) {
                return stage.caption;
            }
        }
        return null;
    }

    public int getCode() {
        return code;
    }
}
